package com.aaron.cdc;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;

import com.aaron.activity.WebViewActivity;
import com.aaron.util.data.DataUtil;
public class MainActivity extends ListActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        ListAdapter listAdapter=new ArrayAdapter<String>(this,R.layout.simple_list_item, R.id.text1, DataUtil.dStrs);
        
        setListAdapter(listAdapter);
        
        
        
        
        
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    protected void onResume() {
    	// TODO Auto-generated method stub
    	super.onResume();
    	
    }
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        
        return false;
    }
    
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
    	switch (position) {
		case 0:
			goToActivity(WebViewActivity.class);
			break;

		default:
			break;
		}
    }
    
    private void goToActivity(Class<?> clas){
    	Intent in=new Intent();
    	in.setClass(this, clas);
    	startActivity(in);
    }
    
    
    
    
    
    
}
